<?php
require("../../funcionesDB.php");
if(isset($_REQUEST['axn'])) {
	if($_REQUEST['axn']=='insert_tags') {
		if ($_REQUEST['rss']!='') {
			$tagsInsertString = "insert into tags (name,rss_id,status) values ('".$_REQUEST['nombre']."',".$_REQUEST['rss'].",'".$_REQUEST['status']."')";
		} else {
			$tagsInsertString = "insert into tags (name,status) values ('".$_REQUEST['nombre']."','".$_REQUEST['status']."')";
		}
		$tagsInsertQuery = dbInsert($tagsInsertString);
	} else if($_REQUEST['axn']=='update_tags') {
		if ($_REQUEST['rss']!='') {
			$tagsUpdateString = "update tags set name='".$_REQUEST['nombre']."', rss_id=".$_REQUEST['rss'].", status='".$_REQUEST['status']."' where tag_id=".$_REQUEST['tag_id'];
		} else {
			$tagsUpdateString = "update tags set name='".$_REQUEST['nombre']."', rss_id=null, status='".$_REQUEST['status']."' where tag_id=".$_REQUEST['tag_id'];
		}
		$tagsUpdateQuery = dbInsert($tagsUpdateString);
	} else if($_REQUEST['axn']=='activate_tags') {
		$tagsUpdateString = "update tags set status='A' where tag_id=".$_REQUEST['tag_id'];
		$tagsUpdateQuery = dbInsert($tagsUpdateString);
	} else if($_REQUEST['axn']=='inactivate_tags') {
		$tagsUpdateString = "update tags set status='I' where tag_id=".$_REQUEST['tag_id'];
		$tagsUpdateQuery = dbInsert($tagsUpdateString);
	}
	header('Location:../index.php?admin=tags');
}


?>